<?php
class FunctionDao {
	public $table = 'function';
	public function get($id){
		return ClassManager::getSql()->oneDataCache($this->table, 'id',intval($id));
	}
	public function getListByFatherId($fatherId){
		return ClassManager::getSql()->datalist($this->table,"*","where father_id=".intval($fatherId));
	}
	public function getListByFatherIdNoId($fatherId,$id){
		return ClassManager::getSql()->datalist($this->table,"*","where father_id=".intval($fatherId)." and id!=".intval($id));
	}
	public function getByFatherId($fatherId){
		return ClassManager::getSql()->oneDataCache($this->table, 'father_id', intval($fatherId));
	}
	public function add($data){
		ClassManager::getSql()->insert($this->table, $data);
	}
	public function update($data,$id){
		ClassManager::getSql()->updates($this->table, $data,"where id=".intval($id));
	}
	public function delete($id){
		ClassManager::getSql()->delete($this->table,"where id=".intval($id));
	}
	public function deleteBatchByid($id){
		ClassManager::getSql()->delete($this->table,"where id in(".$id.")");
	}
	public function getColumnList($fatherId=0){
		return ClassManager::getSql()->datalist($this->table,"*","where father_id=".intval($fatherId)." and display=1");
	}
	public function getByCnByFu($controller,$function){
		return ClassManager::getSql()->onedata($this->table,'*',"where controller='".$controller."' and function='".$function."' ");
	}
	public function getByMark($mark){
		return ClassManager::getSql()->oneDataCache($this->table, 'mark', $mark);
	}
}
?>